import requests
import time
import json

# 先创建url 和 headers，然后直接request看行不行。
url = 'http://hd.gzst.org.cn/action/web/commonApi'

header = {
    "Accept": "application/json, text/javascript, */*; q=0.01",
    "Accept-Encoding": "gzip, deflate",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 NetType/WIFI MicroMessenger/7.0.20.1781(0x6700143B) WindowsWechat(0x63090c2d) XWEB/11581 Flue",
    "Referer": "http://hd.gzst.org.cn/",
    "Content-Length" : "218",
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    "Origin": "http://hd.gzst.org.cn" ,
    "Connection": "keep-alive" ,
    "Host": "appointment-backend-cdn.dataesb.com",
    "XMLHttpRequest": "XMLHttpRequest",
    "Proxy-Connection": "keep-alive",
    "X-Requested-With": "XMLHttpRequest",
    "Cookie": "JSESSIONID=0E84DC2C275F69DA22EADAD20AF8C1FD"
}

post_data = {
    "cmd": "enterFor",
    "libcode": "GS",
    # 50076155为待报名的活动ID，需要替换为最新的活动ID
    "specialId": "50076155",
    "dateId": "0",
    "isGuestEnterFor": "0",
    "enterForType": "1",
    "viewactionTOKEN": "f3048e0e5688e5f7926eec4da0e4ccbf"
}

time_str_13 = int(float(time.time()) * 1000) #创建时间戳
param = {
    "timestamp" : time_str_13,
    "callback" : "#/index/1089?counter=1646524800000"
}

r = requests.post(url, json = post_data, headers = header, params = param, verify = False)